#include <buola/gui.h>

#include <buola/gui/ctoolkit.h>

namespace buola { namespace gui {

bool TKey::operator==(const TKey &pOther) const
{
    return get_toolkit()->KeysEqual(*this,pOther);
}

std::wstring TKey::GetName() 
{
    switch(mKey)
    {
    case KEY_A:
        return L"A";
    case KEY_B:
        return L"B";
    case KEY_C:
        return L"C";
    case KEY_D:
        return L"D";
    case KEY_E:
        return L"E";
    case KEY_F:
        return L"F";
    case KEY_G:
        return L"G";
    case KEY_H:
        return L"H";
    case KEY_I:
        return L"I";
    case KEY_J:
        return L"J";
    case KEY_K:
        return L"K";
    case KEY_L:
        return L"L";
    case KEY_M:
        return L"M";
    case KEY_N:
        return L"N";
    case KEY_O:
        return L"O";
    case KEY_P:
        return L"P";
    case KEY_Q:
        return L"Q";
    case KEY_R:
        return L"R";
    case KEY_S:
        return L"S";
    case KEY_T:
        return L"T";
    case KEY_U:
        return L"U";
    case KEY_V:
        return L"V";
    case KEY_W:
        return L"W";
    case KEY_X:
        return L"X";
    case KEY_Y:
        return L"Y";
    case KEY_Z:
        return L"Z";

    case KEY_1:
        return L"1";
    case KEY_2:
        return L"2";
    case KEY_3:
        return L"3";
    case KEY_4:
        return L"4";
    case KEY_5:
        return L"5";
    case KEY_6:
        return L"6";
    case KEY_7:
        return L"7";
    case KEY_8:
        return L"8";
    case KEY_9:
        return L"9";
    case KEY_0:
        return L"0";

    case KEY_DEL:
    case KEY_KPDEL:
        return L"del";
    case KEY_INS:
    case KEY_KPINS:
        return L"ins";
    case KEY_BACKSPACE:
        return L"bs";
    case KEY_TAB:
        return L"tab";
    case KEY_ENTER:
    case KEY_KPENTER:
        return L"enter";
    case KEY_HOME:
    case KEY_KPHOME:
        return L"home";
    case KEY_END:
    case KEY_KPEND:
        return L"end";
    case KEY_PGUP:
    case KEY_KPPGUP:
        return L"pgup";
    case KEY_PGDN:
    case KEY_KPPGDN:
        return L"pgdn";
    case KEY_LEFT:
    case KEY_KPLEFT:
        return L"left";
    case KEY_UP:
    case KEY_KPUP:
        return L"up";
    case KEY_RIGHT:
    case KEY_KPRIGHT:
        return L"right";
    case KEY_DOWN:
    case KEY_KPDOWN:
        return L"down";

    case KEY_F1:
        return L"F1";
    case KEY_F2:
        return L"F2";
    case KEY_F3:
        return L"F3";
    case KEY_F4:
        return L"F4";
    case KEY_F5:
        return L"F5";
    case KEY_F6:
        return L"F6";
    case KEY_F7:
        return L"F7";
    case KEY_F8:
        return L"F8";
    case KEY_F9:
        return L"F9";
    case KEY_F10:
        return L"F10";
    case KEY_F11:
        return L"F11";
    case KEY_F12:
        return L"F12";
    default:
        return L"unknown";
    }
}

std::string TKey::GetIdentifier()
{
    switch(mKey)
    {
    case KEY_A:
        return "A";
    case KEY_B:
        return "B";
    case KEY_C:
        return "C";
    case KEY_D:
        return "D";
    case KEY_E:
        return "E";
    case KEY_F:
        return "F";
    case KEY_G:
        return "G";
    case KEY_H:
        return "H";
    case KEY_I:
        return "I";
    case KEY_J:
        return "J";
    case KEY_K:
        return "K";
    case KEY_L:
        return "L";
    case KEY_M:
        return "M";
    case KEY_N:
        return "N";
    case KEY_O:
        return "O";
    case KEY_P:
        return "P";
    case KEY_Q:
        return "Q";
    case KEY_R:
        return "R";
    case KEY_S:
        return "S";
    case KEY_T:
        return "T";
    case KEY_U:
        return "U";
    case KEY_V:
        return "V";
    case KEY_W:
        return "W";
    case KEY_X:
        return "X";
    case KEY_Y:
        return "Y";
    case KEY_Z:
        return "Z";

    case KEY_1:
        return "1";
    case KEY_2:
        return "2";
    case KEY_3:
        return "3";
    case KEY_4:
        return "4";
    case KEY_5:
        return "5";
    case KEY_6:
        return "6";
    case KEY_7:
        return "7";
    case KEY_8:
        return "8";
    case KEY_9:
        return "9";
    case KEY_0:
        return "0";

    case KEY_DEL:
    case KEY_KPDEL:
        return "del";
    case KEY_INS:
    case KEY_KPINS:
        return "ins";
    case KEY_BACKSPACE:
        return "bs";
    case KEY_TAB:
        return "U+0009";
    case KEY_ENTER:
    case KEY_KPENTER:
        return "Enter";
    case KEY_HOME:
    case KEY_KPHOME:
        return "home";
    case KEY_END:
    case KEY_KPEND:
        return "end";
    case KEY_PGUP:
    case KEY_KPPGUP:
        return "pgup";
    case KEY_PGDN:
    case KEY_KPPGDN:
        return "pgdn";
    case KEY_LEFT:
    case KEY_KPLEFT:
        return "Left";
    case KEY_UP:
    case KEY_KPUP:
        return "Up";
    case KEY_RIGHT:
    case KEY_KPRIGHT:
        return "Right";
    case KEY_DOWN:
    case KEY_KPDOWN:
        return "Down";

    case KEY_F1:
        return "F1";
    case KEY_F2:
        return "F2";
    case KEY_F3:
        return "F3";
    case KEY_F4:
        return "F4";
    case KEY_F5:
        return "F5";
    case KEY_F6:
        return "F6";
    case KEY_F7:
        return "F7";
    case KEY_F8:
        return "F8";
    case KEY_F9:
        return "F9";
    case KEY_F10:
        return "F10";
    case KEY_F11:
        return "F11";
    case KEY_F12:
        return "F12";
    default:
        return "unknown";
    }
}

/*namespace gui*/ } /*namespace buola*/ }
